<?php 
  require_once('inc_admin.php');
  //连接数据库  
  connect();
  //编写sql语句
  $sql = "select * from flower";

  //如果用户提交了表单，则获取用户输入的关键字
  if($_POST['key'])  {
    $key = trim($_POST['key']);
    $sql = $sql." where wfx_title like '%{$key}%' ";
  }
 //echo $sql.'<br/>';
  $result=fetch_array($sql);
  ?>\
   <center><h3>视频信息列表</h3></center>
 <table align="center" width="80%" border=1>
 <tr>
   <th><a href="#">标题</th>
   <th>产地</th> 
   <th>添加时间</th> 
   <th>点击量</th>     
 </tr>

 <?php
  foreach ($result as $row) {
   echo '<tr>';
   echo '<td>'.$row['wfx_title'].'</td>';
   echo '<td>'.$row['wfx_place'].'</td>';
   echo '<td>'.$row['wfx_adddate'].'</td>';
   echo '<td>'.$row['wfx_hint'].'</td>';

   echo '<td><a href="videoForm.html?id='.$row['wfx_id'].' ">添加</a> | 
   <a href="videoEditForm.php?id='.$row['wfx_id'].' ">修改</a> | 
   <a href="videoDelete.php?id='.$row['wfx_id'].'" onClick="return confirm(\'确定要删除吗？\');">删除</a></td>';
   echo '</tr>';  
  }
  echo '</table>';  
  $totalrows = count($result);
  echo "<table align='center'><tr><td>共有{$totalrows}条记录</td></tr></table>";   
 ?>